### REPLICATION FILE -- APPENDIX
### Jonathan Homola
### "Are Parties Equally Responsive to Women and Men?"
### British Journal of Political Science

## clear environment, set seed, install/load packages
rm(list=ls())
set.seed(12435); options(stringsAsFactors=F)
# install.packages("stargazer"); install.packages("sandwich")
# install.packages("foreign")
library("foreign"); library("stargazer"); library(sandwich)

## set working directory
setwd(" ... ")

## read in the main dataset 
data_full <- read.dta("Homola_WomenMenResponsiveness_Data.dta")

data_niche <- subset(data_full, huber==1)
data <- subset(data_niche, niche==0)

#### Table A4: Parties' responsiveness to different electorates 
#### using rescaled Manifesto data
mod1 <- lm(logrileshift ~ mvshift + logrileshift1, data)
mod2 <- lm(logrileshift ~ wshift + logrileshift1, data)
mod3 <- lm(logrileshift ~ mshift + logrileshift1, data)
mod4 <- lm(logrileshift ~ wshift + mshift + logrileshift1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A5: Party responsiveness at different levels 
#### of female seat share using rescaled Manifesto data
mod1 <- lm(logrileshift ~ wshift + womenpar + wparlxwshift + logrileshift1, data)
mod2 <- lm(logrileshift ~ wshift + womenpar + wparlxwshift + logrileshift1 + 
             votediff1 + logrileshift:votediff1, data)
mod3 <- lm(logrileshift ~ mshift + womenpar + wparlxmshift + logrileshift1, data)
mod4 <- lm(logrileshift ~ mshift + womenpar + wparlxmshift + logrileshift1 + 
             votediff1 + logrileshift:votediff1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A6: Party responsiveness at different levels 
#### of female seat share using lagged female seat share data
data$wparlagxwshift <- data$wpar_lag * data$wshift
data$wparlagxmshift <- data$wpar_lag * data$mshift
mod1 <- lm(pshift ~ wshift + wpar_lag + wparlagxwshift + pshift1, data)
mod2 <- lm(pshift ~ wshift + wpar_lag + wparlagxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1, data)
mod3 <- lm(pshift ~ mshift + wpar_lag + wparlagxmshift + pshift1, data)
mod4 <- lm(pshift ~ mshift + wpar_lag + wparlagxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A7: Party responsiveness at different levels 
#### of female seat share (party-level)
mod1 <- lm(pshift ~ wshift + pfem + pfemxwshift + pshift1, data)
mod2 <- lm(pshift ~ wshift + pfem + pfemxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1, data)
mod3 <- lm(pshift ~ mshift + pfem + pfemxmshift + pshift1, data)
mod4 <- lm(pshift ~ mshift + pfem + pfemxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A8: Leftist parties' responsiveness to different electorates
left <- subset(data, left==1)
mod1 <- lm(pshift ~ mvshift + pshift1, left)
mod2 <- lm(pshift ~ wshift + pshift1, left)
mod3 <- lm(pshift ~ mshift + pshift1, left)
mod4 <- lm(pshift ~ wshift + mshift + pshift1, left)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A9: Leftist parties' responsiveness 
#### at different levels of female seat share
mod1 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1, left)
mod2 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1, left)
mod3 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1, left)
mod4 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1, left)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A10: Rightist parties' responsiveness to different electorates
right <- subset(data, right==1)
mod1 <- lm(pshift ~ mvshift + pshift1, right)
mod2 <- lm(pshift ~ wshift + pshift1, right)
mod3 <- lm(pshift ~ mshift + pshift1, right)
mod4 <- lm(pshift ~ wshift + mshift + pshift1, right)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A11: Right parties' responsiveness 
#### at different levels of female seat share
mod1 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1, right)
mod2 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1, right)
mod3 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1, right)
mod4 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1, right)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A12: Parties' responsiveness to different electorates 
#### under low female seat shares
low <- subset(data, womenpar<26)
mod1 <- lm(pshift ~ mvshift + pshift1, low)
mod2 <- lm(pshift ~ wshift + pshift1, low)
mod3 <- lm(pshift ~ mshift + pshift1, low)
mod4 <- lm(pshift ~ wshift + mshift + pshift1, low)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A13: Parties' responsiveness to different electorates 
#### under high female seat shares
high <- subset(data, womenpar>26)
mod1 <- lm(pshift ~ mvshift + pshift1, high)
mod2 <- lm(pshift ~ wshift + pshift1, high)
mod3 <- lm(pshift ~ mshift + pshift1, high)
mod4 <- lm(pshift ~ wshift + mshift + pshift1, high)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A14: Parties' responsiveness to different electorates 
#### at varying income levels
mod1 <- lm(pshift ~ whincmvshift + pshift1, data)
mod2 <- lm(pshift ~ wlincmvshift + pshift1, data)
mod3 <- lm(pshift ~ mhincmvshift + pshift1, data)
mod4 <- lm(pshift ~ mlincmvshift + pshift1, data)
mod5 <- lm(pshift ~ whincmvshift + mhincmvshift + pshift1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
se5 <- sqrt(diag(vcovHC(mod5, "HC1")))
stargazer(mod1, mod2, mod3, mod4, mod5,
          se = list(se1, se2, se3, se4, se5),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A15: Parties' responsiveness to different electorates 
#### at varying education levels
mod1 <- lm(pshift ~ whedumvshift + pshift1, data)
mod2 <- lm(pshift ~ wledumvshift + pshift1, data)
mod3 <- lm(pshift ~ mhedumvshift + pshift1, data)
mod4 <- lm(pshift ~ mledumvshift + pshift1, data)
mod5 <- lm(pshift ~ whedumvshift + mhedumvshift + pshift1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
se5 <- sqrt(diag(vcovHC(mod5, "HC1")))
stargazer(mod1, mod2, mod3, mod4, mod5,
          se = list(se1, se2, se3, se4, se5),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A16: Parties' responsiveness to different electorates 
#### including time controls
data$time1 <- data$time2 <- data$time3 <- data$time4 <- 0
data$time1 <- ifelse(data$eyear<1980, 1, 0)
data$time2 <- ifelse((data$eyear<1990 & data$time1==0), 1, 0)
data$time3 <- ifelse((data$eyear<2000 & data$time1==0 & data$time2==0), 1, 0)
data$time4 <- ifelse((data$time1==0 & data$time2==0 & data$time3==0), 1, 0)
mod1 <- lm(pshift ~ mvshift + pshift1 + time2 + time3 + time4, data)
mod2 <- lm(pshift ~ wshift + pshift1 + time2 + time3 + time4, data)
mod3 <- lm(pshift ~ mshift + pshift1 + time2 + time3 + time4, data)
mod4 <- lm(pshift ~ wshift + mshift + pshift1 + time2 + time3 + time4, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A17: Parties' responsiveness to different electorates 
#### including time trends
data$yeartrend <- data$eyear - 1972
mod1 <- lm(pshift ~ mvshift + pshift1 + yeartrend, data)
mod2 <- lm(pshift ~ wshift + pshift1 + yeartrend, data)
mod3 <- lm(pshift ~ mshift + pshift1 + yeartrend, data)
mod4 <- lm(pshift ~ wshift + mshift + pshift1 + yeartrend, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A18: Parties' responsiveness to different electorates 
#### including time interactions
data$post <- ifelse(data$eyear>1993, 1, 0)
data$postmv <- data$post * data$mvshift
data$postfe <- data$post * data$wshift
data$postma <- data$post * data$mshift
mod1 <- lm(pshift ~ mvshift + postmv + post + pshift1, data)
mod2 <- lm(pshift ~ wshift + postfe + post + pshift1, data)
mod3 <- lm(pshift ~ mshift + postma + post + pshift1, data)
mod4 <- lm(pshift ~ wshift + mshift + postfe + postma + post + pshift1, data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A19: Robustness checks for preference shifts among women
mod1 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + ideol, data)
mod2 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + niche + nichexwshift, data_niche)
mod3 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + as.factor(party), data)
mod4 <- lm(pshift ~ wshift + womenpar + wparlxwshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + as.factor(country), data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")


#### Table A20: Robustness checks for preference shifts among men
mod1 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + ideol, data)
mod2 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + niche + niche:mshift, data_niche)
mod3 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + as.factor(party), data)
mod4 <- lm(pshift ~ mshift + womenpar + wparlxmshift + pshift1 + 
             votediff1 + pshiftxvotediff1 + as.factor(country), data)
se1 <- sqrt(diag(vcovHC(mod1, "HC1")))
se2 <- sqrt(diag(vcovHC(mod2, "HC1")))
se3 <- sqrt(diag(vcovHC(mod3, "HC1")))
se4 <- sqrt(diag(vcovHC(mod4, "HC1")))
stargazer(mod1, mod2, mod3, mod4,
          se = list(se1, se2, se3, se4),
          omit.stat=c("f", "ser", "bic", "ll", "adj.rsq"), 
          star.cutoffs = c(0.1, 0.05, 0.01), 
          column.sep.width="1pt", digits=2,
          dep.var.labels.include = FALSE,
          dep.var.caption="Outcome variable: Change in Party Position")